/*
Copyright:Sheng
~~~~~~~~~~~~~~~~~~~~
����libSegmenter3ʵ��ȫ������
*/
#include "libConnect.hpp"
#include "libSegmenter3.h"

int main(int argc, char* argv[])
{
	std::cout << "version:" << s_Check_VERSION << std::endl; //�汾
	std::cout << "update time:" << s_update_time << std::endl; //��������
	if (s_version_nginx)
	{
		std::cout << "\n###!!!###\nonly for nginx rtmp\n###!!!###" << std::endl;
	}
	else if (s_version_vod)
	{
		std::cout << "\n### VOD MODULE ###\nstart-up vod-module" << std::endl;
		std::cout << "VOD add \"-cheat\" and \"-onlycheat\" param" << std::endl;
		if (s_version_vod_makeHLS)
		{
			std::cout << "make the HLS-m3u8" << std::endl;
		}
		else
		{
			std::cout << "no HLS-m3u8" << std::endl;
		}
		if (s_version_vod_removeP2P)
		{
			std::cout << "remove P2P file." << std::endl;
		}
		else
		{
			std::cout << "keep P2P file." << std::endl;
		}
		if (s_version_vod_NonChange)
		{
			std::cout << "No transcoding ! " << std::endl;
		}
		if (s_version_vod_SetChangeParams)
		{
			std::cout << "Set Change Params ! " << std::endl;
		}
		if (s_version_vod_AudioPreprocessing)
		{
			std::cout << "Audio be Preprocessing" << std::endl;
		}
		else
		{
		}
		std::cout << "### VOD MODULE ###" << std::endl;
	}
	if (1)
	{
		std::cout << "\n### LIVE MODULE ###" << std::endl;
		std::cout << "set live param : " << std::endl;
		std::cout << "\"-live -cheat ts\"" << std::endl;
		std::cout << "start-up cheat-module" << std::endl;
		std::cout << "### LIVE MODULE ###" << std::endl;
	}
	if (s_version_java)
	{
		std::cout << "###!!!###\nopen backserver message\n###!!!###" << std::endl;
	}
	if (b_log)
	{
		std::cout << "\n###!!!###\nopen log file\n###!!!###" << std::endl;
	}
	if (argc == 2)
	{
		if (0 == strcmp(argv[1], "-v"))//-v ��ӡ�汾
			return 0;
	}
	//
	if (1)//test 
	{
		libConnect Sk;
		if (Sk.Connect())
		{
			cout << "Failed Check." << endl;
			return 1;
		}
	}
	//
	//if (0 == strcmp(argv[1], "-file"))//���������ļ����ڵ�seg���� ��mainʵ��
	//{
	//	if (NULL == argv[2])
	//	{
	//		cout << "File txt error." << endl;
	//		return 1;
	//	}
	//	seg_father ff;
	//	std::ifstream i_file;
	//	i_file.open(argv[2], std::ios::in | std::ios::binary);
	//	if (!i_file.is_open())
	//	{
	//		cout << "Failed read txt." << endl;
	//		return 1;
	//	}
	//	string str_local;
	//	while (!i_file.eof())
	//	{
	//		getline(i_file, str_local);
	//		string str_instructions;			
	//		str_instructions.assign("nohup ");
	//		str_instructions.append(str_local);
	//		str_instructions.append(" 2>&1 &");
	//		cout << str_instructions << endl;
	//		system(str_instructions.c_str());
	//	}
	//	i_file.close();
	//	return 0;
	//}
	//
	libSegmenter3 seg_l(argc, argv);	
	return 0;
}
